<?php

namespace Product\Model;

use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

class ProductTemplate {

	public $id;
	public $name;
	public $description;
	public $status;
	public $type;
	public $pricefrequency;
	public $item_id;
	public $sellpriceformula_id;
	public $cost_currencyvalue_id;
	public $listprice_currencyvalue_id;
	public $sellprice_currencyvalue_id;
	public $inputFilter;
	
	 public function exchangeArray($data)
    {
        //$this->id = (isset($data['id'])) ? $data['id'] : null;
        $this->name = (isset($data['name'])) ? $data['name'] : null;
        $this->description = (isset($data['description'])) ? $data['description']:null;
        $this->status = (isset($data['status'])) ? $data['status']:null;
		$this->type = (isset($data['type'])) ? $data['type']:null;
		$this->pricefrequency = (isset($data['pricefrequency'])) ? $data['pricefrequency']:null;
        $this->item_id = (isset($data['item_id'])) ? $data['item_id']:null;
		$this->sellpriceformula_id = (isset($data['sellpriceformula_id'])) ? $data['sellpriceformula_id']:null;
		$this->cost_currencyvalue_id = (isset($data['cost_currencyvalue_id'])) ? $data['cost_currencyvalue_id']:null;
		$this->listprice_currencyvalue_id = (isset($data['listprice_currencyvalue_id'])) ? $data['listprice_currencyvalue_id']:null;
		$this->sellprice_currencyvalue_id = (isset($data['sellprice_currencyvalue_id'])) ? $data['sellprice_currencyvalue_id']:null;
	}
	
	public function __construct(array $options = null) {
		if (is_array ( $options )) {
			$this->setOptions ( $options );
		}
	}
	public function getArrayCopy() {
		return get_object_vars ( $this );
	}
	public function setInputFilter(InputFilterInterface $inputFilter) {
		throw new \Exception ( "Not used" );
	}
	public function getInputFilter() {
		if (! $this->inputFilter) {
			$inputFilter = new InputFilter ();
			
			$inputFilter->add ( array (
					'name' => 'id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'Int' 
							) 
					) 
			) );
	
	
			$inputFilter->add ( array (
					'name' => 'name',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'description',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'status',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'type',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'pricefrequency',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'item_id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'sellpriceformula_id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'cost_currencyvalue_id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'listprice_currencyvalue_id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$inputFilter->add ( array (
					'name' => 'sellprice_currencyvalue_id',
					'required' => true,
					'filters' => array (
							array (
									'name' => 'StripTags' 
							),
							array (
									'name' => 'StringTrim' 
							) 
					) 
			) );
			
			$this->inputFilter = $inputFilter;
		}
		
		return $this->inputFilter;
	}
}